package com.atguigu.designpattern.strategy;

/**
* @program: springcloud
* @description: 返利收费 满300减100
* @author: wangjun
* @create: 2021-05-18
**/
public class CashReturn implements CashSuper{

    double moneyCondition = 0d;

    double moneyReturn = 0d;

    public CashReturn(double moneyCondition, double moneyReturn) {
        this.moneyCondition = moneyCondition;
        this.moneyReturn = moneyReturn;
    }

    @Override
    public double acceptCash(double money) {
        double result = money;
        if(money >= moneyCondition){
            result =  money - Math.floor((money / moneyCondition) * moneyReturn);
        }
        return result;
    }
}
